package spring.angularjs.services;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import spring.angularjs.dao.AccountDAO;
import spring.angularjs.dao.CustomerDAO;
import spring.angularjs.dao.ReportTransactionDAO;
import spring.angularjs.dao.TransactionDAO;
import spring.angularjs.dao.UserDAO;
import spring.angularjs.domain.Account;
import spring.angularjs.domain.Customer;
import spring.angularjs.domain.Reporttransaction;
import spring.angularjs.domain.Transaction;
import spring.angularjs.domain.User;

@Service
public class ServicesImpl implements Services {

	@Autowired
	private UserDAO userDAO;
	
	@Autowired
	private TransactionDAO transactionDAO;
	
	@Autowired
	private ReportTransactionDAO reportTransactionDAO;
	
	@Autowired
	private AccountDAO accountDAO;
	
	@Autowired
	private CustomerDAO customerDAO;
	
	@Override
	@Transactional
	public User getUserAuthentication(String iduser) {
		return userDAO.getUserAuthentication(iduser);
	}

	@Override
	@Transactional
	public List<Transaction> getListTransaction() {
		return transactionDAO.getListTransaction();
	}

	@Override
	@Transactional
	public List<Transaction> getListTransactionNotReport() {
		return transactionDAO.getListTransactionNotReport();
	}

	@Override
	@Transactional
	public Transaction getTransacionById(String id) {
		return transactionDAO.getTransacionById(id);
	}

	@Override
	@Transactional
	public void updateTransaction(Transaction tr) {
		transactionDAO.updateTransaction(tr);
	}

	@Override
	@Transactional
	public void addReportTransaction(Reporttransaction rtt) {
		reportTransactionDAO.addReportTransaction(rtt);
	}

	@Override
	@Transactional
	public List<Account> getListAccount() {
		return accountDAO.getListAccount();
	}

	@Override
	@Transactional
	public Account getAccountById(String id) {
		return accountDAO.getAccountById(id);
	}

	@Override
	@Transactional
	public Customer getCustomerById(String id) {
		return customerDAO.getCustomerById(id);
	}

	@Override
	@Transactional
	public void updateAccount(Account ac) {
		accountDAO.updateAccount(ac);
	}

	@Override
	@Transactional
	public List<Customer> getListCustomer() {
		return customerDAO.getListCustomer();
	}

	@Override
	@Transactional
	public List<Account> getListAccountOfCustomer(String id) {
		return accountDAO.getListAccountOfCustomer(id);
	}

}
